Page({
  data: {
    array: ['美国', '中国', '巴西', '日本', '英国', '法国'],
    objectArray: [{
      key: 'usa',
      name: '美国'
    }, {
      key: 'chn',
      name: '中国'
    }, {
      key: 'br',
      name: '巴西'
    }, {
      key: 'jp',
      name: '日本'
    }, {
      key: 'uk',
      name: '英国'
    }, {
      key: 'fr',
      name: '法国'
    }],
    selectorIndex: 0,
    time: '08:10', //默认时间
    date: '2023-01-11', //默认时间
    region: ['山东省', '济南市', '历下区'], //默认省市区
  },
  onLoad:function(){
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.emit('acceptData', {data: 'test'});  //向调用该页面的页面返回数据
  },
  selectorOperation: function (event) {
    console.log("选择了" + this.data.array[event.detail.value]);
    this.setData({
      selectorIndex: event.detail.value
    })
    //异步写入本地数据，这里用于页面之前的数据传递
    wx.setStorage({
      key: 'country',
      data: this.data.array[event.detail.value]
    });
  },
  timeOperation: function (event) {
    this.setData({
      time: event.detail.value
    });
  },
  dateOperation: function (event) {
    this.setData({
      date: event.detail.value
    });
  },
  regionOperation: function (event) {
    console.log(event.detail)
  },
  sliderChangeOperation: function (event) {
    console.log("change:" + event.detail.value)
  },
  sliderChangingOperation: function (event) {
    console.log("changing:" + event.detail.value)
  }
})